using UnityEngine;

public class Background : MonoBehaviour
{
    public float speed = 2f;

    public Background otherBackground;

    // Start is called before the first frame update
    void Start()
    {
    }

    // Update is called once per frame
    void Update()
    {
        transform.Translate(Vector3.down * speed * Time.deltaTime);

        if (transform.position.y < -8.52f)
        {
            transform.position = new Vector3(otherBackground.transform.position.x,
                otherBackground.transform.position.y + 8.52f,
                otherBackground.transform.position.z);
        }
    }
}